# CMake 最低版本号要求
cmake_minimum_required(VERSION 3.0)

####################### Toolchain #######################
message( ">> Build use environment: ${ENV}" )
message( ">> Build debug: ${DEBUG}" )

if(DEBUG)
    message( ">> debug on" )
else()
    message( ">> debug off" )
endif()

set(CMAKE_TOOLCHAIN_FILE "../cmake/${ENV}/toolchain.cmake")

message( ">> Build toolchain file: ${CMAKE_TOOLCHAIN_FILE}" )

######################## Project ########################
project (BeagleBone)

######################## src #########################
aux_source_directory(${CMAKE_SOURCE_DIR}/src DIR_SRCS)
aux_source_directory(${CMAKE_SOURCE_DIR}/src/uvc DIR_SRCS)

###################### BlackLib ######################
aux_source_directory(${CMAKE_SOURCE_DIR}/BlackLib/v3_0 DIR_SRCS)
list(REMOVE_ITEM DIR_SRCS ${CMAKE_SOURCE_DIR}/BlackLib/v3_0/examples.cpp)

aux_source_directory(${CMAKE_SOURCE_DIR}/BlackLib/v3_0/BlackADC DIR_SRCS)
aux_source_directory(${CMAKE_SOURCE_DIR}/BlackLib/v3_0/BlackDirectory DIR_SRCS)
aux_source_directory(${CMAKE_SOURCE_DIR}/BlackLib/v3_0/BlackGPIO DIR_SRCS)
aux_source_directory(${CMAKE_SOURCE_DIR}/BlackLib/v3_0/BlackI2C DIR_SRCS)
aux_source_directory(${CMAKE_SOURCE_DIR}/BlackLib/v3_0/BlackMutex DIR_SRCS)
aux_source_directory(${CMAKE_SOURCE_DIR}/BlackLib/v3_0/BlackPWM DIR_SRCS)
aux_source_directory(${CMAKE_SOURCE_DIR}/BlackLib/v3_0/BlackSPI DIR_SRCS)
aux_source_directory(${CMAKE_SOURCE_DIR}/BlackLib/v3_0/BlackThread DIR_SRCS)
aux_source_directory(${CMAKE_SOURCE_DIR}/BlackLib/v3_0/BlackTime DIR_SRCS)
aux_source_directory(${CMAKE_SOURCE_DIR}/BlackLib/v3_0/BlackUART DIR_SRCS)


###################### include ######################
include_directories(
    ${CMAKE_SOURCE_DIR}/src/include
    ${CMAKE_SOURCE_DIR}/BlackLib/v3_0
)

######################## Third_party ########################
# Third_party include
include_directories(
    ${CMAKE_SOURCE_DIR}/ThirdParty/glog/include
)

# Third_party libs
link_directories(
    ${CMAKE_SOURCE_DIR}/ThirdParty/glog/lib/arm-linux-gnueabihf
)

##################### Target option #####################
set(TARGET "BeagleBone")
add_executable(${TARGET} ${DIR_SRCS})

